import random

# 石头剪刀布
def game1(round):
    player_score = computer_score = 0
    for i in range(round):
        player = input("请输入石头、剪刀或者布：")
        computer = random.choice(["石头","剪刀","布"])
        print(f"电脑出的是{computer}")
        if player == computer:
            player_score += 1
            computer_score += 1
        elif (player == "石头" and computer == "剪刀") or (player == "剪刀" and computer == "布") or (player == "布" and computer == "剪刀"):
            player_score += 1
        else:
            computer_score += 1

    if player_score == computer_score:
        print("平局")
    elif player_score > computer_score:
        print("玩家胜利")
    else:
        print("电脑胜利")


# 猜数游戏
def guess_number(start,end,chance):
    number = random.randint(start,end)
    while True:
        player = int(input("请输入你猜测的数字："))
        if player == number:
            print("猜中了!")
            break
        elif player > number:
            print("猜大了")
            chance -= 1
        else:
            print("猜小了")
            chance -= 1

        if chance == 0:
            print("挑战失败，请重新开始游戏")
            break

guess_number(1,3,3)